Vaccine data, Cases data from the hospital, and the waste water
signal data has been loaded, cleaned, and then merged into one final
dataframe, final_data.
The variables have been log transformed.
The response variable observed_census_ICU_p_acute_care
has been renamed as y and the date has been renamed as ds to fit the
prophet model.
The dataset is divided into train and test set. The test set consist of last 3 days of data.
Adding other variable as regressors to the model.
Fitting the Prophet Model.
Forecasting 3 days into future
Checking last 6 days of the forecast data
#> ds yhat yhat_lower yhat_upper
#> 407 2022-01-27 5.124032 4.497328 5.829416
#> 408 2022-01-28 5.166120 4.477755 5.841051
#> 409 2022-01-29 5.166638 4.397888 5.872686
#> 410 2022-01-30 5.307423 4.584879 6.049761
#> 411 2022-01-31 5.224058 4.531361 5.946665
#> 412 2022-02-01 5.288598 4.575756 6.030408
The plot of actual data and predicted data from Prophet forecast. The blue line is predicted data whereas the black dots are actual data.
Root Mean Squared Error on the train set:
#> [1] 17.27543
MAPE on train set:
#> [1] 0.322955
Standard deviation of the actual data
#> [1] 35.92902
Plots comparing actual data and predicted data
RMSE on test set:
#> [1] 114.2621
MAPE on test set
#> [1] 1.418613
Plots comparing actual test data and predicted test data
The error metrics are high when model is regressed against only those who received 2nd dose in all the different age groups.
The model trend shows a strong linear increase in trend of hospitalizations in 2021 until October and from October to December there is a weak linear increase in hospitalizations. The extra regressor plot shows the additive effect of regressors and it shows that 2nd dose of vaccination in all different age groups remains high until April/May 2021 and then shows a sharp decrease in July 2021 and then remains low and steady until January 2022. Weekly trend shows there are more hospitalizations on Tuesday and Thursday.